package com.example.vp.controller.user;

import com.common.domain.R;
import com.common.holder.UserHolder;
import com.example.vp.domian.enetity.Collect;
import com.example.vp.domian.enetity.CollectDetails;
import com.example.vp.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("user-collect")
@RequestMapping("/collect/user")
public class CollectController {
    @Autowired
    private CollectService collectService;
    /**
     * 根据用户id获取收藏夹
     */
    @GetMapping
    public R getCollect(){
        Long userId = UserHolder.getUserId();
        List<Collect> collect = collectService.getCollect(userId);
        return R.ok().data(collect);
    }
    /**
     *获取详细收藏夹 
     */
    
    /**
     * 用户收藏视频
     */
    @PostMapping
    public R collectVideo(@RequestParam Long collectId,@RequestParam Long videoId){
        collectService.collect(collectId,videoId);
        return R.ok().data("收藏成功咯");
    }
}
